package com.wanghua.mall.order.openfeign;

import com.wanghua.common.utils.R;
import com.wanghua.mall.order.vo.WareSkuStockVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * @author wanghua
 * @create 2021-09-08 14:46
 */
@FeignClient("mall-ware")
public interface WareClient {

    //查询sku是否有库存 TODO 也可以封装实体类或使用map
    @PostMapping("/ware/waresku/getStockBySku")
    R getStockBySku(@RequestBody List<Long> skuIdList);

    /**
     * 根据地址id获取运费
     *
     * @param addressId
     * @return
     */
    @GetMapping("/ware/wareinfo/fare/{addressId}")
    R getFare(@PathVariable("addressId") Long addressId);

    /**
     * 为订单锁定库存
     *
     * @param wareSkuStockVo
     * @return
     */
    @PostMapping("/ware/waresku/orderLockStock")
    R orderLockStock(@RequestBody WareSkuStockVo wareSkuStockVo);
}
